package com.shop.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.pojo.wms.Wms_Ware_Info;
import com.shop.service.Wms_Ware_Info_Service;
import com.shop.utils.LayuiUtils;
import com.shop.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 后台仓库信息-李贝贝
 */
@RestController
@RequestMapping("/ware")
public class Wms_Ware_Info_Controller {

    @Autowired
    private Wms_Ware_Info_Service wms_ware_info_service;


    /**
     * 显示所有仓库
     * @param page
     * @param limit
     * @param wms_ware_info
     * @return
     */
    @GetMapping("/find_admin_All_ware")
    public LayuiUtils<Wms_Ware_Info> find_admin_All_Ware(Integer page,Integer limit,Wms_Ware_Info wms_ware_info){
        Page<Wms_Ware_Info> pages = new Page<>(page,limit);
        return wms_ware_info_service.find_admin_All_Ware(pages,wms_ware_info);
    }

    /**
     * 添加仓库
     * @param wms_ware_info
     * @return
     */
    @PostMapping("/insert_admin_ware")
    public R insert_admin_Ware(@RequestBody Wms_Ware_Info wms_ware_info){
        System.out.println(wms_ware_info);
        return wms_ware_info_service.insert_admin_ware(wms_ware_info);
    }

    /**
     * 删除仓库
     * @param id
     * @return
     */
    @DeleteMapping("/delete_admin_ware")
    public R delete_admin_Ware(@RequestParam List<Long> id){
        return wms_ware_info_service.delete_admin_ware(id);
    }

    /**
     * 修改仓库信息
     * @param wms_ware_info
     * @return
     */
    @PutMapping("/update_admin_ware")
    public R update_admin_Ware(@RequestBody Wms_Ware_Info wms_ware_info){
        System.out.println(wms_ware_info);
        return wms_ware_info_service.update_admin_ware(wms_ware_info);
    }
}
